//
//  DHDescribeView.m
//  发;fjag
//
//  Created by 刘鹏飞 on 2016/11/14.
//  Copyright © 2016年 刘鹏飞. All rights reserved.
//

#import "DHDescribeView.h"
#import <Masonry.h>
#import "XHHAdditions.h"

@implementation DHDescribeView

+(instancetype)describeView {
    
   DHDescribeView *describeView = [[DHDescribeView alloc] init];
    //创建子控件
    UILabel *describeLabel = [UILabel XHH_labelWithText:@"疾病描述" fontSize:15 color:[UIColor blackColor]];
    UILabel *AddLabel = [UILabel XHH_labelWithText:@"添加病症描述标签" fontSize:15 color:[UIColor cyanColor]];
    UIButton *addBotton = [[UIButton alloc] init];
    [addBotton setImage:[UIImage imageNamed:@"add_40x40"] forState:UIControlStateNormal];
    UITextView *textView = [[UITextView alloc] init];
    textView.backgroundColor = [UIColor XHH_colorWithHex:0xf9f9f9];
    UIView *sepLineViewThree = [[UIView alloc] init];
    sepLineViewThree.backgroundColor = [UIColor XHH_colorWithHex:0xf9f9f9];
    
    //添加到父控件
    [describeView addSubview:describeLabel];
    [describeView addSubview:addBotton];
    [describeView addSubview:AddLabel];
    [describeView addSubview:textView];
    [describeView addSubview:sepLineViewThree];

    //布局子视图
    [describeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(describeView).offset(8);
        make.top.equalTo(describeView).offset(20);
    }];
    [addBotton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(describeLabel);
        make.right.equalTo(describeView).offset(-8);
        make.size.mas_equalTo(CGSizeMake(20, 20));
    }];
    [AddLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(describeLabel);
        make.right.equalTo(addBotton.mas_left).offset(-8);
    }];
    [textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(describeView).offset(20);
        make.bottom.right.equalTo(describeView).offset(-20);
        make.top.equalTo(describeLabel.mas_bottom  ).offset(20);
    }];
    [sepLineViewThree mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.right.left.equalTo(describeView);
        make.height.mas_equalTo(1);
    }];

    return describeView;

}

@end
